module fpmultiplier_behav(
    output logic [31:0] product,
    output logic        ready,
    input  logic [31:0] a,
    input  logic        clock, nreset
);
enum {start, loada, loadb} state;

shortreal rproduct, ra;

always @(*) begin
    product = $shortrealtobits(rproduct);
end

always @(*) begin
    ra = $bitstoshortreal(a);
end

always @(posedge clock, negedge nreset) begin
    if (~nreset) begin
        rproduct <= 0;
        state <= start;
    end
    else begin
        case(state)
            start: begin
                state <= loada;
            end

            loada: begin
                rproduct <= ra;
                state <= loadb;
            end

            loadb: begin
                rproduct <= rproduct * ra;
                state <= start;
            end
        endcase
    end
end

always @(*) begin
    ready = (state == start);
end

endmodule